﻿namespace Gmantis.Controls.DataGrid
{
    public static class DataGridSelectionModeExtension
    {
        public static bool IsCellSelectionMode(this DataGridSelectionMode selectionMode)
        {
            switch (selectionMode)
            {
                case DataGridSelectionMode.None:
                    return false;

                case DataGridSelectionMode.SingleCell:
                    return true;

                case DataGridSelectionMode.SingleRow:
                    return false;

                case DataGridSelectionMode.SingleColumn:
                    return false;

                case DataGridSelectionMode.SingleRange:
                    return true;

                case DataGridSelectionMode.MultiColumn:
                    return false;

                case DataGridSelectionMode.MultiRange:
                    return true;
            }
            return false;
        }

        public static bool IsColumnSelectionMode(this DataGridSelectionMode selectionMode)
        {
            switch (selectionMode)
            {
                case DataGridSelectionMode.None:
                    return false;

                case DataGridSelectionMode.SingleCell:
                    return false;

                case DataGridSelectionMode.SingleRow:
                    return false;

                case DataGridSelectionMode.SingleColumn:
                    return true;

                case DataGridSelectionMode.SingleRange:
                    return false;

                case DataGridSelectionMode.MultiColumn:
                    return true;

                case DataGridSelectionMode.MultiRange:
                    return false;
            }
            return false;
        }

        public static bool IsMultiMode(this DataGridSelectionMode selectionMode)
        {
            switch (selectionMode)
            {
                case DataGridSelectionMode.None:
                    return false;

                case DataGridSelectionMode.SingleCell:
                    return false;

                case DataGridSelectionMode.SingleRow:
                    return false;

                case DataGridSelectionMode.SingleColumn:
                    return false;

                case DataGridSelectionMode.SingleRange:
                    return false;

                case DataGridSelectionMode.MultiColumn:
                    return true;

                case DataGridSelectionMode.MultiRange:
                    return true;
            }
            return true;
        }

        public static bool IsRowSelectionMode(this DataGridSelectionMode selectionMode)
        {
            switch (selectionMode)
            {
                case DataGridSelectionMode.None:
                    return false;

                case DataGridSelectionMode.SingleCell:
                    return false;

                case DataGridSelectionMode.SingleRow:
                    return true;

                case DataGridSelectionMode.SingleColumn:
                    return false;

                case DataGridSelectionMode.SingleRange:
                    return false;

                case DataGridSelectionMode.MultiColumn:
                    return false;

                case DataGridSelectionMode.MultiRange:
                    return false;
            }
            return true;
        }

        public static bool IsSingleMode(this DataGridSelectionMode selectionMode)
        {
            switch (selectionMode)
            {
                case DataGridSelectionMode.None:
                    return false;

                case DataGridSelectionMode.SingleCell:
                    return true;

                case DataGridSelectionMode.SingleRow:
                    return true;

                case DataGridSelectionMode.SingleColumn:
                    return true;

                case DataGridSelectionMode.SingleRange:
                    return true;

                case DataGridSelectionMode.MultiColumn:
                    return false;

                case DataGridSelectionMode.MultiRange:
                    return false;
            }
            return false;
        }
    }
}
